package com.xyhuo.leetcode.y2025;

import java.util.HashSet;
import java.util.Set;

public class MinOperations {
    public int minOperations(int[] nums, int k) {
        Set<Integer> set = new HashSet<>();
        int min = nums[0];
        for (int num : nums) {
            set.add(num);
            if (num < min) {
                min = num;
            }
        }
        int ans = -1;
        if (min < k) {
            return ans;
        }
        if (min != k) {
            ans = set.size();
        } else {
            ans = set.size() - 1;
        }
        return ans;
    }
}
